from langchain import hub
from langchain_core.output_parsers import StrOutputParser
from patagent.llm import PatsnapLLM

llm = PatsnapLLM()

# Prompt
prompt = hub.pull("rlm/rag-prompt")

# Post-processing
def format_docs(docs):
    return "\n\n".join(doc.page_content for doc in docs)

# Chain
answer_chain = prompt | llm | StrOutputParser()

# Run
# generation = answer_chain.invoke({"context": docs, "question": question})
# print(generation)